const p = function() {
  return new Promise((resolve, reject) => {
    const p1 = new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve(1)
      }, 0);
      resolve(2) // 注释了这行就是 3 end 4 1
    })
    p1.then(res => {
      console.log(res)
    })
    console.log(3)
    resolve(4)
  })
}

p().then(res => {
  console.log(res)
})

console.log('end')

// 我的答案
// 3 - end -  4 - 2 - 1

// 实际答案
// 3
// end
// 2
// 4